From: verdre Date: Tue, 17 Apr 2018 12:51:20 +0000 (+0200) Subject: loginDialog: Ensure old timed login timeout is removed before starting a new one X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~929^2~5^2~97 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=522a5fe480c45fb35dbe7fe7e2fc48560ad608b5;p=gnome-shell.git loginDialog: Ensure old timed login timeout is removed before starting a new one Normally, we give the user a 5 second grace period of inactivity before starting a timed login operation. Unfortunately, that grace period timeout isn't properly removed if the timed login operation is restarted during the grace period. That means the timeout handler can inadvertently get called multiple times leading to the grace period duration getting subtracted from the total animation time more than once. This commit ensures we only ever have one grace period timeout scheduled at a time. --- diff --git a/js/gdm/loginDialog.js b/js/gdm/loginDialog.js index dc5eaa235..017947689 100644 --- a/js/gdm/loginDialog.js +++ b/js/gdm/loginDialog.js @@ -1010,6 +1010,7 @@ var LoginDialog = new Lang.Class({ this._timedLoginIdleTimeOutId = GLib.timeout_add_seconds(GLib.PRIORITY_DEFAULT, _TIMED_LOGIN_IDLE_THRESHOLD, () => { this._timedLoginAnimationTime -= _TIMED_LOGIN_IDLE_THRESHOLD; + this._timedLoginIdleTimeOutId = 0; hold.release(); return GLib.SOURCE_REMOVE; }); @@ -1024,6 +1025,12 @@ var LoginDialog = new Lang.Class({ this._timedLoginBatch = null; } + // Reset previous idle-timeout + if (this._timedLoginIdleTimeOutId) { + GLib.source_remove(this._timedLoginIdleTimeOutId); + this._timedLoginIdleTimeOutId = 0; + } + this._timedLoginItem = null; this._timedLoginDelay = delay; this._timedLoginAnimationTime = delay;